package com.shali.wechat.order.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import com.shali.wechat.order.config.GirlConfig;


@RefreshScope
@RestController
public class PropertiesController {

	@Autowired
	private GirlConfig girlConfig;
	
	@Value("${ok.name}")
	private String ok;
	
	@GetMapping("/ok")
	public String girl() {
	
		return ok;
	}
	
	@GetMapping("/girl/{s}")
	public String girl(@PathVariable("s") String s) {
		if("name".equals(s)) {
			return girlConfig.getName();
		}
		if("age".equals(s)) {
			return girlConfig.getAge();
		}
		return "error";
	}
}

